home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 7430 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.1 KB  |  55 lines

  1. Newsgroups: comp.arch.arithmetic,comp.lang.c,comp.lang.c++
  2. Path: Utrecht.NL.net!news
  3. From: Franz Korntner <fkorntne@bazis.nl>
  4. Subject: Re: Access carry flag from C
  5. X-Nntp-Posting-Host: bastion1.bazis.nl
  6. Content-Type: text/plain; charset=us-ascii
  7. Message-ID: <312D850C.2781@bazis.nl>
  8. Sender: news@inter.NL.net (News at newsutr)
  9. Content-Transfer-Encoding: 7bit
  10. Organization: NLnet
  11. References: <Dn1C9z.DGv.0.net@indra.com> <1996Feb1922.17.19.879@koobera.math.uic.edu> <31298D20.41C6@bazis.nl> <danpop.824859220@rscernix> <312AFACE.41C6@bazis.nl> <824997378snz@genesis.demon.co.uk>
  12. Mime-Version: 1.0
  13. Date: Fri, 23 Feb 1996 09:12:44 GMT
  14. X-Mailer: Mozilla 2.0 (X11; I; OSF1 V3.2 alpha)
  15.  
  16. Lawrence Kirby wrote:
  17.  
  18. > There is no guarantee that a particular implementations supports a 32 bit
  19. > type. Whatever type you use you have to use the relevant limits for that
  20. > type.
  21.  
  22. True.
  23.  
  24. > >According to the (X3J11 / ANSI) standard, the constant
  25. > >INT_MAX (and in this case most limits in limits.h) denotes the minimal
  26. > >limit. It is possible that the physical limit is much higher (or lower
  27. > >in the case of negative values).
  28. > No. The value defined for INT_MAX in limits.h is the maximum value an int
  29. > can hold *on that particular implementation*. The standard requires that
  30. > INT_MAX be at least 32767 on all implementations (but it can be and
  31. > often is higher). So on any implementation:
  32. >   int x = INT_MAX+1;
  33. > is a guaranteed overflow.
  34.  
  35. Wrong. The limits are minima. The above operation does not have to overflow!
  36.  
  37. > >and what I really miss in the
  38. > >standard and/or implementation is a inline function 'maxlimitof(int)',
  39. > >analogical to 'sizeof(int)'.
  40. > That is precisely what INT_MAX gives you.
  41.  
  42. INT_MAX is a constant. On some platforms you can force GCC to assume int's
  43. to be 16 bit values. What about INT_MAX then?!?
  44.  
  45. -- 
  46. +-----------------------------------------------------------------------+
  47. | Franz Korntner at BAZIS, dept. System Development, Leiden, Netherlands|
  48. | E-mail: fkorntne@hiscom.nl                                            |
  49. +-----------------------------------------------------------------------+
  50.